{include file="header.html"}
<script type="text/javascript">
    $(function () {
        $('#integral_goods_form').validate({
            errorPlacement: function (error, element) {
                $(element).next('.field_notice').hide();
                $(element).after(error);
            },
            success: function (label) {
                label.addClass('right').text('OK!');
            },
            onkeyup: false,
            rules: {
                goods_name: {
                    required: true,
                    remote: {//唯一
                        url: 'index.php?app=integral_goods&act=check_integral_goods',
                        type: 'get',
                        data: {
                            goods_name: function () {
                                return $('#goods_name').val();
                            },
                            id: '{$integral_goods.goods_id}'
                        }
                    }
                },
                goods_stock: {
                    required: true,
                    number: true
                },
                goods_stock_exchange: {
                    required: true,
                    number: true
                },
                goods_price: {
                    required: true,
                    number: true
                },
                goods_point: {
                    required: true,
                    number: true
                },
                goods_logo: {
                    accept: 'gif|png|jpe?g'
                },
                sort_order: {
                    number: true
                }
            },
            messages: {
                goods_name: {
                    required: '{$lang.goods_empty}',
                    remote: '{$lang.name_exist}'
                },
                goods_stock: {
                    required: '{$lang.empty}',
                    number: '{$lang.need_number}'
                },
                goods_stock_exchange: {
                    required: '{$lang.empty}',
                    number: '{$lang.need_number}'
                },
                goods_price: {
                    required: '{$lang.empty}',
                    number: '{$lang.need_number}'
                },
                goods_point: {
                    required: '{$lang.empty}',
                    number: '{$lang.need_number}'
                },
                goods_logo: {
                    accept: '{$lang.limit_img}'
                },
                sort_order: {
                    number: '{$lang.number_only}'
                }
            }
        });
    });
</script>
<div id="rightTop">
    <p>{$lang.integral_goods}</p>
    <ul class="subnav">
        <li><a class="btn1" href="index.php?app=integral_goods">{$lang.manage}</a></li>
        {if $integral_goods.goods_id}
        <li><a class="btn1" href="index.php?app=integral_goods&amp;act=add">{$lang.add}</a></li>
        {else}
        <li><span>{$lang.add}</span></li>
        {/if}
        <li><a class="btn1" href="index.php?app=integral_goods&amp;act=log">{$lang.integral_goods_log}</a></li>
    </ul>
</div>

<div class="info">
    <form method="post" enctype="multipart/form-data" id="integral_goods_form">
        <table class="infoTable">
            <tr>
                <th class="paddingT15">
                    {$lang.goods_name}:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" id="goods_name" type="text" name="goods_name" value="{$integral_goods.goods_name|escape}" /> <label class="field_notice">{$lang.goods_name_note}</label>
                </td>
            </tr>
            
            
            <tr>
                <th class="paddingT15">
                    {$lang.goods_stock}:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" id="goods_stock" type="text" name="goods_stock" value="{$integral_goods.goods_stock|escape}" /> <label class="field_notice">{$lang.goods_stock_note}</label>
                </td>
            </tr>
            <tr>
                <th class="paddingT15">
                    {$lang.goods_stock_exchange}:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" id="goods_stock_exchange" type="text" name="goods_stock_exchange" value="{$integral_goods.goods_stock_exchange|escape}" /> <label class="field_notice">{$lang.goods_stock_exchange_note}</label>
                </td>
            </tr>
            
            <tr>
                <th class="paddingT15">
                    {$lang.goods_price}:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" id="goods_price" type="text" name="goods_price" value="{$integral_goods.goods_price|escape}" /> <label class="field_notice">{$lang.goods_price_note}</label>
                </td>
            </tr>
            <tr>
                <th class="paddingT15">
                    {$lang.goods_point}:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" id="goods_point" type="text" name="goods_point" value="{$integral_goods.goods_point|escape}" /> <label class="field_notice">{$lang.goods_point_note}</label>
                </td>
            </tr>
            
            <tr>
                <th class="paddingT15">
                    {$lang.goods_logo}:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableFile2" id="goods_logo" type="file" name="goods_logo" />
                    <label class="field_notice">{$lang.limit_img_note}</label>
                </td>
            </tr>
            {if $integral_goods.goods_logo}
            <tr>
                <th class="paddingT15">
                </th>
                <td class="paddingT15 wordSpacing5">
                    <img src="{$integral_goods.goods_logo}" class="makesmall" max_width="120" max_height="90" />
                </td>
            </tr>
            {/if}
            <tr>
                <th class="paddingT15">
                    {$lang.sort_order}:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="sort_order" id="sort_order" type="text" name="sort_order" value="{$integral_goods.sort_order}" />
                    <label class="field_notice">{$lang.update_order_note}</label>
                </td>
            </tr>
            <tr>
                <th></th>
                <td class="ptb20">
                    <input class="formbtn" type="submit" name="Submit" value="{$lang.submit}" />
                    <input class="formbtn" type="reset" name="Submit2" value="{$lang.reset}" />
                </td>
            </tr>
        </table>
    </form>
</div>
{include file="footer.html"}
